package cn.fu.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.fu.aop.Common;
import cn.fu.core.bean.TestTb;
import cn.fu.core.service.TestTbService;

@Controller
public class TestAop {
	//非注解
	@Autowired
	private Common common;
	
	//注解AOP
	@Autowired
	private TestTbService testTbService;
	/**
	 * springMVC测试
	 * @return
	 */
	@RequestMapping("toAop.do")
	public String toIndex(){
		common.execute("zhengjunhua","zhengjunhua");
		return "index";
	}
	
	@RequestMapping("annotation.do")
	public String testAopAnnotation(){
		List<TestTb> list = testTbService.selectTestTbList();
		for (TestTb testTb : list) {
			System.err.println(testTb);
		}
		return "index";
	}
	
	@RequestMapping("aopAdd.do")
	public String testAopAnnotAdd(){
		TestTb testTb = new TestTb();
		testTbService.insertTestTb(testTb);
		return "index";
	}
}
